import request from '@/network'

// 获取标签
export const queryLabelsRequest = async (currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.get({
    url: '/label',
    params: {
      currentPage,
      pageSize,
    },
  })
  return result
}
// 获取所有标签
export const getAllLabelsRequest = async () => {
  const result = await request.get({
    url: '/label/all',
  })
  return result
}
// 修改标签名称
export const updateLabelNameRequest = async (label_id: number, label_name: string) => {
  const result = await request.patch({
    url: '/label/update_label_name',
    data: {
      label_id,
      label_name,
    },
  })
  return result
}
// 删除标签
export const deleteLabelRequest = async (label_id: number) => {
  const result = await request.delete({
    url: '/label/delete_label',
    data: {
      label_id,
    },
  })
  return result
}
// 添加标签
export const addLabelRequest = async (name: string) => {
  const result = await request.post({
    url: '/label/add',
    data: {
      name,
    },
  })
  return result
}
